﻿@model Site3AI.Models.QizSessionDetail
<li>
    @if (String.IsNullOrEmpty(Model.QizSubjectDefine.ShortTitle))
    {
        <span>@(Model.QizSubjectDefine.QizItem.Title):</span>
    }
    else
    {
        <span>@(Model.QizSubjectDefine.ShortTitle):</span>
    }
    @{
        var typeval = Model.QizSubjectDefine.QizItem.TypeRef.OptionValue;                                        
    }
    @if (typeval == "4" || typeval == "5")
    {
        var enumList = Model.QizSubjectDefine.QizItem.EnumDefine.EnumValues;  
        if (typeval == "4")
        {
            EnumValue enumItem = enumList.SingleOrDefault(enumValue => Model.UserSelValue.Contains(enumValue.EnumValID));
        <span>
            @(enumItem != null ? String.Format("{0} {1}", enumItem.OptionTitle, enumItem.OptionDescription) : "")
        </span>
        }
        else if (typeval == "5")
        {
            string checkedValues = string.Empty;
        <span>
            @foreach (var enumItem in enumList)
            {
                if (Model.UserSelValue.Contains(enumItem.EnumValID))
                {
                    checkedValues += String.Format("{0} {1}、", enumItem.OptionTitle, enumItem.OptionDescription);
                }
            }
            @if (!String.IsNullOrEmpty(checkedValues))
            {
                checkedValues = checkedValues.TrimEnd('、');
            }
            @checkedValues
        </span>
        }
    }
    else
    {
        <span>@Model.UserValue</span>
    }
</li>
